package com.atguigu.tingshu.search.service;

import co.elastic.clients.elasticsearch.core.SearchRequest;
import co.elastic.clients.elasticsearch.core.SearchResponse;
import com.atguigu.tingshu.model.search.AlbumInfoIndex;
import com.atguigu.tingshu.model.search.SuggestIndex;
import com.atguigu.tingshu.query.search.AlbumIndexQuery;
import com.atguigu.tingshu.vo.album.TrackStatMqVo;
import com.atguigu.tingshu.vo.search.AlbumInfoIndexVo;
import com.atguigu.tingshu.vo.search.AlbumSearchResponseVo;

import java.util.List;
import java.util.Map;

public interface SearchService {


    void upperAlbum(Long albumId);

    void lowerAlbum(Long albumId);

    AlbumSearchResponseVo searchAlbum(AlbumIndexQuery albumIndexQuery);

    SearchRequest buildDSL(AlbumIndexQuery albumIndexQuery);

    AlbumSearchResponseVo parseResult(SearchResponse<AlbumInfoIndex> searchResponse, AlbumIndexQuery albumIndexQuery);

    List<Map<String, Object>> channel(Long category1Id);

    void saveSuggestIndex(AlbumInfoIndex albumInfoIndex);


    /**
     * 根据用户已录入字符查询提词索引库进行自动补全关键字
     * @param keyword
     * @return
     */
    List<String> completeSuggest(String keyword);

    /**
     * 解析建议词结果
     * @param searchResponse
     * @param suggestName
     * @return
     */
    List<String> parseSuggestResult(SearchResponse<SuggestIndex> searchResponse, String suggestName);

    Map<String, Object> albumInfo(Long albumId);

    void updateStatOnEs(TrackStatMqVo mqVo);

    void updateLatelyAlbumRanking(Integer top);

    List<AlbumInfoIndexVo> getRankingList(Long category1Id, String dimension);
}
